package com.zhuss.controller.product;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.product.product.CreateProductBo;
import com.zhuss.bean.bo.product.product.DeleteProductBo;
import com.zhuss.bean.bo.product.product.UpdateProductBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.product.product.ProductOperateServiceExt;
import com.zhuss.exception.OceanException;


/**
 * @description: 商品操作的Controller
 * @author: zhushanshuo
 * @create: Wed Mar 24 22:26:45 CST 2021
 **/
@RestController
@RequestMapping("/product")
public class ProductOperateController extends BaseController {
	
	@Autowired
	@Qualifier("productOperateService")
	private OperateService<Void, Object> productOperateService;
	
	@Autowired
	@Qualifier("productOperateServiceExt")
	private ProductOperateServiceExt productOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateProductBo bo) throws OceanException {
		
		productOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateProductBo bo) throws OceanException {
		
		productOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteProductBo bo) throws OceanException {
		
		productOperateService.delete(bo);
    }
	
}
